<!--************************************************************************************************-->
<!-- < addGroupResult.php >                                                                           -->
<!-- Copyright (c) 2012-2013 San Yat-sun University School of Software                              -->
<!-- Founder : Tianjiao Li                                                                          -->
<!-- Stu : 10389129                                                                                 -->
<!-- Date: 2012-12-18                                                                               -->
<!-- Destription : Add Group Result.                                                         -->
<!-- Basic: User:root                                                                               -->
<!--	    Password:                                                                               -->
<!-- Version : 2.1                                                                                  -->
<!-- LastUpdate : 2012-12-23 16:00 BY Tianjiaoli                                                    -->
<!--************************************************************************************************-->

<!DOCTYPE html>
<?php
	session_start();
?>
<html lang="zh-hk">
	<?php
	include_once("../manager/GroupManager.php");
	include_once("../db/User.php");
	include_once("../db/Group.php");
	//include_once("header.php");
	
	// ================��ǰ̨�?��ƺ���ݿ����=====================
	if( isset($_POST['groupname'])) 
	{
		$Groupname = $_POST['groupname'];
		$GroupBrief = $_POST['content'];
		//====================modified by xiaoxin=========
		//暂定为默认创建人为管理者
		$ManagerName = $_POST['managername'];
		$Username = $_SESSION['currentUser'];
		
		//============== sql add! img address
		$_FILES["file"]["name"] = $Groupname.".jpg";
		move_uploaded_file($_FILES["file"]["tmp_name"],"../images/Groups/" . $_FILES["file"]["name"]);
		
		/*Edit By Tianjiao Li*/
		
		$array = array('Groupname'=>$Groupname, 'GroupBrief'=>$GroupBrief, 'ManagerName'=>$ManagerName);
		$data = array('Username'=>$Username, 'Groupname'=>$Groupname);
		
		$groupm = new GroupManager();
		$groupm->insert($array,$data);	
		
		// Edit BY Tianjiaoli AT 2012-12-23 17:16
		$groupm->MemberOf($data);
		// Edit By TianjiaoLi

		// ��õ�ǰ�������С�飬������ת��С��ҳ��
		$_SESSION['currentGroup'] = $Groupname;
		//====================================================
	}
	else
	{
		echo "Error: ".mysql_error();
	}
	
	
	?>
	
	<head>
		<meta http-equiv="Content-Type" content="text/html charset=UTF-8">
		<meta name="contentType" value="text/html  charset=GBK">
		<meta name="description" content="在这里你可以看到最新发布的书籍，和好友共享对某本书的评论和笔记">
		<meta http-equiv="imagetoolbar" content="no">
		<meta name="viewport" content="width=1036">
		
		<title>TINY bOOk</title>
		<link rel="stylesheet" type="text/css" href="../css/result.css"/> <!--==============modified by xiaoxin-->
		<link rel="shortcut icon" href="images/shortcut.jpg"/>
		<meta http-equiv="refresh" content="1; url=myPage.php">
	</head>	
		
	<body>
		<div id="title">
			<h1>TINY bOOk</h1>
		</div>

		
		<div id="result">
			<p>success</a></p>
		</div>

		<div id="bottom">
				<p>@2012 - 2014 by cat-fish,all rights reserves</p>
		</div>
	</body>
</html>